<?php
/**
 * Created by PhpStorm.
 * User: cong.ding
 * Date: 2017/10/10
 * Time: 16:46
 */

include_once("DBUtil.php");
include_once("common_util.php");

$db =new DBUtil();

$result=["result"=>"","message"=>""];
$data =[
  "type"=>$_POST['type'],
  "name"=>$_POST['name'],
  "qr_code"=>$_POST['qr_code'],
  "arrived_time"=>check_date_default($_POST['arrived_time']),
  "purchase_time"=>check_date_default($_POST['purchase_time']),
  "produce_time"=>check_date($_POST['produce_time']),
  "expire_time"=>check_date($_POST['expire_time']),
  "count"=>$_POST['count'],
  "comment"=>$_POST['comment'],
  "status"=>'0',
];
$result_id =$db->insert("goods_info",$data);
if (!isset($result_id)||empty($result_id)) {
  $result["result"]=false;
  $result["message"]= mysqli_error($db);
} else {
  $result["result"]=true;
}
echo json_encode(["data"=>$result]);